package com.example.resourceSharingPlatform.mappers;


import org.springframework.jdbc.core.RowMapper;
import com.example.resourceSharingPlatform.entity.Transaction;

import java.sql.ResultSet;
import java.sql.SQLException;


public class TransactionRowMapper implements RowMapper<Transaction>{
	
	 @Override
	    public Transaction mapRow(ResultSet rs, int i) throws SQLException{
		
		   Transaction transaction = new Transaction();
		   
		   transaction.setId(rs.getInt("id"));
		   transaction.setTime(rs.getString("time"));
		   transaction.setLender_id(rs.getString("lender_id"));
		   transaction.setBorrow_id(rs.getString("borrow_id"));
		   transaction.setState(rs.getString("state"));
		   transaction.setAmount(rs.getDouble("amount"));
		   transaction.setItem_id(rs.getInt("item_id"));
		   transaction.setRentalTime(rs.getInt("rentalTime"));
	       return transaction;
	    }
	

}
